@extends('layouts.master')

@section("css")
    @parent
    <link rel="stylesheet" type="text/css" href="/css/pages/list.css">
    <link rel="stylesheet" type="text/css" href="/css/pages/case/list.css">
@stop

@section("body")
@include("components.left")

<div class="list_content">
    <div class="search_div">
        <div class="search_title">
            <img src="/images/houtaianliku_06.png">患者搜索
        </div>
        <div class="search_box">
            <label>患者姓名：</label>
            <input id="name" type="text" name="" placeholder="请输入患者姓名"
                @if(array_key_exists('name',$conditions))
                    value="{{$conditions['name']}}"
                @endif
            >
            <label>性别：</label>
            <input id="sex" type="radio" name="sex" value="1" 
                 @if(array_key_exists('sex',$conditions) && $conditions['sex'] == 1)
                    checked="checked" 
                 @endif
            >男
            <input id="sex" type="radio" name="sex" value="0"
                @if(array_key_exists('sex',$conditions) && $conditions['sex'] == 0)
                    checked="checked" 
                 @endif
            >女
            <label>省份：</label>
            <select id="province">
                <option value="">--请选择--</option>
                @foreach($provinces as $province)
                    <option value = "{{$province['id']}}"
                        @if(array_key_exists('province_id',$conditions) && $conditions['province_id'] == $province['id'])
                            selected="selected" 
                        @endif
                    >{{$province['province_name']}}</option>
                @endforeach
            </select>
            <label>案例类型：</label>
            <select id="case_type">
                <option value="">--请选择--</option>
                @foreach($caseTypes as $caseType)
                    <option value = "{{$caseType['type_name']}}" 
                        @if(array_key_exists('case_type',$conditions) && $conditions['case_type'] == $caseType['type_name'])
                            selected="selected" 
                        @endif
                    >{{$caseType['type_name']}}</option>
                @endforeach
            </select>
            <div class="btn">
                <div id="select_btn" class="select_btn">
                    查询
                </div>
                <div id="clean_btn" class="clean_btn">
                    清除
                </div>
            </div>
        </div>
    </div>
    <div class="list_table">
        <table>
            <thead>
                <tr>
                    <th>编号</th>
                    <th>案例类型</th>
                    <th>姓名</th>
                    <th>年龄</th>
                    <th>性别</th>
                    <th>省份</th>
                    <th>城市</th>
                    <th>治疗方式</th>
                    <th>手术时间</th>
                    <th>身高</th>
                    <th>创建人</th>
                    <th>最后操作时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                @foreach($cases as $case)
                <tr>
                    <td>{{$case['id']}}</td>
                    <td>{{$case['case_type']}}</td>
                    <td>{{$case['name']}}</td>
                    <td>{{$case['age']}}</td>
                    <td>{{$case['sex']}}</td>
                    <td>{{$case['province']['province_name']}}</td>
                    <td>{{$case['city']['city_name']}}</td>
                    <td>{{$case['manner']}}</td>
                    <td>{{$case['time']}}</td>
                    <td>{{$case['height']}}</td>
                    <td>{{$case['user_name']}}</td>
                    <td>{{$case['updated_at']}}</td>
                    <td>
                        <a href="/admin/case/update?id={{$case['id']}}"><div class="get_btn">查看</div></a>
                        @if(Auth::user()->role_id == 1)
                        <div class="delete_btn">删除</div>
                        @endif
                    </td>
                </tr>
                @endforeach
            </tbody>
        </table>
    </div>
    <div class="page_div">
        <div class="page_info">
            共<span>{{$cases->total()}}</span>条记录
        </div>
        <a href="{{$cases->previousPageUrl()}}">
            <div class="prev_page">
                上一页
            </div>
        </a>
        <a href="{{$cases->nextPageUrl()}}">
            <div class="next_page">
                下一页
            </div>
        </a>
    </div>
</div>

@stop

@section("js")
    @parent
    <script type="text/javascript" src="/js/pages/case/list.js"></script>
@stop